package com.joplus.housekeeper.ui.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ScrollView;

/**
 * Created by Administrator on 2016/7/14.
 */
public class VerticalScrollView extends ScrollView {

    float lastTouchX;
    public VerticalScrollView(Context context) {
        super(context);
    }

    public VerticalScrollView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public VerticalScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public boolean onInterceptHoverEvent(MotionEvent event) {

        switch (event.getAction()){
            case MotionEvent.ACTION_DOWN:
                lastTouchX=event.getRawX();
                break;
            case MotionEvent.ACTION_MOVE:
                if(event.getRawX()>lastTouchX){
                    return false;
                }

        }
        return true;
    }
}
